import 'package:animal/ui/goods/page/confirm_order_page.dart';
import 'package:animal/ui/goods/page/norms_dialog.dart';
import 'package:animal/ui/goods/page/shop_info_page.dart';
import 'package:animal/utils/screen_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';

class GoodsInfoController extends GetxController{
  //滚动controller
  ScrollController? scrollController;

  var appBarColor = Colors.transparent.obs;

  //是否收藏
  RxBool isCheck = false.obs;

  @override
  void onInit() {
    super.onInit();
    scrollController = ScrollController();
    scrollController!.addListener(() {
      debugPrint("${scrollController!.offset}");
      if(scrollController!.offset>70){
        appBarColor.value = Colors.blue;
      }else{
        appBarColor.value = Colors.transparent;
      }
    });
  }

  ///前往店铺
  void gotoShopInfo(){
    Get.to(ShopInfoPage());
  }

  ///前往订单
  void gotoOrder(){
    Get.to(ConfirmOrderPage());
  }

  ///选择规格
  void selectNorms(){
    SmartDialog.show(widget: Container(height:ScreenUtil().L(600),child: NormsDialog()),alignmentTemp: Alignment.bottomCenter);
  }
}